﻿   <!---------------------防脱育发知识------------------------>
<dl class="knowledge">
    <dt><br/><img src='@Url.Content("~/img/title3.png")'></dt>
    <dd id="datalist">
    </dd>
</dl>

<script type="text/javascript">


    $(function () {
        getknowledgepart();
    });

    function getknowledgepart() {
        var type = 4;
        var queryUrl = querybase + '/News/GetPageList' + "?NewsType=" + type + "&PageSize=6&PageIndex=1&Sort=BaseModifyTime";

        $.ajax({
            type: "GET",
            url: queryUrl,
            data: {},
            datatype: "json",
            success: function (data) {
                var items = data.Data;
                var htm = "";
                if (items != null && items != undefined) {
                    for (var i = 0; i < items.length; i++) {

                        var show_date = getDate(items[i].BaseModifyTime);

                        htm += '<a href=\"\/home\/detail\/' + items[i].Id + '\">'
                            + '<div class=\"date\">' + show_date.getDate() + '<span>' + show_date.getFullYear() + '.' + show_date.getMonth() + '</span></div>'
                            + '<div class=\"content\">'
                            + '<h1>' + items[i].NewsTitle + '</h1>'
                            + '<p>' + items[i].NewsTag + '</p>'
                            + '</div>'
                            + '</a >';
                    }

                    $("#datalist").append(htm);
                }
            }
        });
    }

    //字符串转日期格式，strDate要转为日期格式的字符串
    function getDate(strDate) {
        var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
            function (a) {
                return parseInt(a, 10) - 1;
            }).match(/\d+/g) + ')');
        return date;
    }

</script>